<div class='details-issue-wrap' data-bind='with:issueDetails, attr: {style:issueDetails.style}'>
	<div class='details-no-issue' data-bind='visible: issue() == null'>
		Не выбрана ни одна задача
	</div>
	<div class='details-issue' data-bind='if:issue() != null'>
		<div class='details-issue-content' data-bind='css:{loading:issue().loading}'>
			<textarea placeholder="Название" class="custom-textarea header form-control" data-bind="
				value:issue().name, 
				event:{change:issue().update},
				textareaAutoResize:true
			"></textarea>
			<table class='table table-striped' data-bind='with:issue'>
				<tr>
					<td>Статус</td>
					<td>
						<!-- ko template:{name:'custom-select',data:{options:all.issueStatuses, optionsText:'name', value: status, onChange:update}} -->
						<!-- /ko -->
					</td>
				</tr>
				<tr>
					<td>Тип</td>
					<td>
						<!-- ko template:{name:'custom-select',data:{options:all.issueTypes, optionsText:'name', value: type, onChange:update}} -->
						<!-- /ko -->
					</td>
				</tr>
				<tr>
					<td>Исполнитель</td>
					<td>
						<!-- ko template:{name:'custom-select',data:{options:all.users, optionsText:'name', value: assignee, onChange:update}} -->
						<!-- /ko -->
					</td>
				</tr>
				<tr>
					<td>Этап</td>
					<td>
						<!-- ko template:{name:'custom-select',data:{options:all.chunks, optionsText:'name', value: chunk, onChange:update}} -->
						<!-- /ko -->
					</td>
				</tr>
				<tr>
					<td>Оценка, ч</td>
					<td>
						<input class="custom-input" data-bind='value:estimate, event:{change:update}' />
					</td>
				</tr>
			</table>
			<h4>Описание</h4>
			<textarea placeholder="Добавить описание" class="custom-textarea form-control" data-bind="
				value:issue().description, 
				event:{change:issue().update},
				textareaAutoResize:true
			"></textarea>
		</div>
	</div>
</div>

<script type="text/html" id='custom-select'>
	<div class="custom-select">
		<span type="button" class="dropdown-toggle" data-toggle="dropdown">
			<span data-bind="text:value() != null ? value()[optionsText] : ''"></span>
			<span class="caret"></span>
		</span>
		<ul class="dropdown-menu" role="menu" data-bind="foreach:options">
			<li>
				<a href="#" data-bind="click:function(value){$parent.value(value);$parent.onChange()},text:$data[$parent.optionsText]"></a>
			</li>
		</ul>
	<div>
</script>